home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / a_to_d / dbplus2 / dbluplus.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  1.7 KB  |  80 lines

  1. {
  2.  
  3.    Component Registration Module
  4.    DB Aware Components for Delphi
  5.  
  6.    Copyright (c) 1995 Ducks Software, All Rights Reserved
  7.  
  8. }
  9.  
  10. unit Dbluplus;
  11.  
  12. interface
  13.  
  14. uses Classes, DsgnIntf, DBLup2 ;
  15.  
  16.   procedure Register;
  17.  
  18. implementation
  19.  
  20. uses {DB,} DBTables{, DBCtrls, DBGrids, Report, Controls, MaskProp, MaskText,
  21.   Mask, DBConsts, SysUtils, DBLookup, DSDesign, DBEdit, FldLinks, TypInfo,
  22.   LibConst, QBE, QBindDlg, ProcDlg};
  23.  
  24.  
  25. { TDBStringProperty }
  26.  
  27. type
  28.   TDBStringProperty = class(TStringProperty)
  29.   public
  30.     function GetAttributes: TPropertyAttributes; override;
  31.     procedure GetValueList(List: TStrings); virtual; abstract;
  32.     procedure GetValues(Proc: TGetStrProc); override;
  33.   end;
  34.  
  35. function TDBStringProperty.GetAttributes: TPropertyAttributes;
  36. begin
  37.   Result := [paValueList, paSortList, paMultiSelect];
  38. end;
  39.  
  40. procedure TDBStringProperty.GetValues(Proc: TGetStrProc);
  41. var
  42.   I: Integer;
  43.   Values: TStringList;
  44. begin
  45.   Values := TStringList.Create;
  46.   try
  47.     GetValueList(Values);
  48.     for I := 0 to Values.Count - 1 do Proc(Values[I]);
  49.   finally
  50.     Values.Free;
  51.   end;
  52. end;
  53.  
  54. { TIndexNameProperty }
  55.  
  56. type
  57.   TIndexNameProperty = class(TDBStringProperty)
  58.   public
  59.     procedure GetValueList(List: TStrings); override;
  60.   end;
  61.  
  62. procedure TIndexNameProperty.GetValueList(List: TStrings);
  63. begin
  64.   ((GetComponent(0) as TDBLookupComboPlus).LookUpSource.DataSet as TTable).GetIndexNames(List);
  65. end;
  66.  
  67. { TLeftRightProperty }
  68.  
  69.  
  70.  
  71.  
  72.  
  73. procedure Register;
  74. begin
  75.   RegisterComponents('Data Controls', [TDBLookupComboPlus]);
  76.   RegisterPropertyEditor(TypeInfo(string), TDBLookupComboPlus, 'LookupIndex', TIndexNameProperty);
  77. end;
  78.  
  79. end.
  80.